/*
 * Created: Author: Aléx Carvalho / Date: Feb 13, 2015
 * 
 * Changed: $Author: ac280593@gmail.com $ / $Date: 2015-06-05 00:21:41 +0000 (Fri, 05 Jun 2015) $
 */
package com.cpm.view.zk.tables;

import com.cpm.view.Element;
import java.util.List;
import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zul.ListModel;
import org.zkoss.zul.ListModelList;
import org.zkoss.zul.Listbox;

public class DefaultTable<T> implements Element<HtmlBasedComponent>{

    private final Listbox listbox = new Listbox();
    private ListModel listModel = null;
    
    public DefaultTable() {
    }

    public void setListModel(ListModel listModel) {
        this.listModel = listModel;
        listbox.setModel(listModel);
    }

    public void setItems(List<T> items) {
        listbox.setModel( new ListModelList<>(items));
    }

    @Override
    public HtmlBasedComponent getElement() {
        return listbox;
    }
    
}
